<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE validators PUBLIC
  		"-//OpenSymphony Group//XWork Validator 1.0//EN" 
  		"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">

<validators>
<#assign baseName=table.getBaseRecordType().shortName>
<#list table.getAllColumns() as column>
    <#assign fieldName=baseName?uncap_first+"."+column.getJavaProperty()>
	<field name="${fieldName}">
	 <#assign type=column.resolvedJavaType.fullyQualifiedJavaType.getShortName()>
	 <#if type="Integer">
	    <field-validator type="int">
			<param name="min"><#if column.nullable>0<#else>1</#if></param>
			<param name="max">${genRule.getMax(column.length)?string('##')}</param>
			<message><![CDATA[${fieldName} must be integer min <#if column.nullable>0<#else>1</#if> max ${genRule.getMax(column.length)?string('##')} if supplied ]]></message>
		</field-validator>
	  <#elseif type="Long">
	    <field-validator type="int">
			<param name="min"><#if column.nullable>0<#else>1</#if></param>
			<param name="max">${genRule.getMax(column.length)?string('##')}</param>
			<message><![CDATA[${fieldName} must be integer min <#if column.nullable>0<#else>1</#if> max ${genRule.getMax(column.length)?string('##')} if supplied ]]></message>
	  </field-validator>
	 <#elseif type="String">
	   <field-validator type="stringlength">
			<param name="minLength"><#if column.nullable>0<#else>1</#if></param>
			<param name="maxLength">${column.length?string('##')}</param>
			<message><![CDATA[${fieldName} must be a String of a specific greater than <#if column.nullable>0<#else>1</#if> less than ${column.length?string('##')} if specified ]]></message>
		</field-validator>
	<#elseif type="Date">
	   <field-validator type="date">
			<param name="min">01/01/1990</param>
			<param name="max">01/01/2000</param>
			<message><![CDATA[ must be a min 01-01-1990 max 01-01-2000 if supplied ]]></message>
		</field-validator>
	 </#if>
	</field>
</#list>
</validators>
